(:: pragma bea:global-element-parameter parameter="$inventoryCheck1" element="ns0:InventoryCheck" location="../WSDLs/InventoryCheck.wsdl" ::)
(:: pragma bea:global-element-parameter parameter="$inventoryCheckResponse1" element="ns0:InventoryCheckResponse" location="../WSDLs/InventoryCheck.wsdl" ::)
(:: pragma bea:global-element-return element="ns1:offerCheck" location="../WSDLs/offerCheck.wsdl" ::)

declare namespace ns1 = "http://www.example.org/offerCheck/";
declare namespace ns0 = "http://www.example.org/InventoryCheck/";
declare namespace xf = "http://tempuri.org/ActivateNewCustomer/Transformation/test/";

declare function xf:test($inventoryCheck1 as element(ns0:InventoryCheck),
    $inventoryCheckResponse1 as element(ns0:InventoryCheckResponse))
    as element(ns1:offerCheck) {
        <ns1:offerCheck>
            <offerId>{ data($inventoryCheck1/offerId) }</offerId>
            <mvnoID>{ data($inventoryCheckResponse1/partnerId) }</mvnoID>
            <clearwireMarketID>{ data($inventoryCheck1/clearwireMarketId) }</clearwireMarketID>
            {
                for $SKU in $inventoryCheckResponse1/SKU
                return
                    <SKU>{ data($SKU) }</SKU>
            }
            {
                for $Realm in $inventoryCheck1/Realm
                return
                    <realm>{ data($Realm) }</realm>
            }
            {
                for $lbsType in $inventoryCheck1/lbsType
                return
                    <lbsType>{ data($lbsType) }</lbsType>
            }
            {
                for $mvnoReferenceNumber in $inventoryCheck1/mvnoReferenceNumber
                return
                    <mvnoReferenceNumber>{ data($mvnoReferenceNumber) }</mvnoReferenceNumber>
            }
            <customer_id>{ data($inventoryCheckResponse1/customerId) }</customer_id>
            <service_id>{ data($inventoryCheckResponse1/serviceId) }</service_id>
            {
                for $mvnoMarketId in $inventoryCheck1/mvnoMarketId
                return
                    <mvnoMarketID>{ data($mvnoMarketId) }</mvnoMarketID>
            }
            <macID>{ data($inventoryCheck1/macId) }</macID>
        </ns1:offerCheck>
};

declare variable $inventoryCheck1 as element(ns0:InventoryCheck) external;
declare variable $inventoryCheckResponse1 as element(ns0:InventoryCheckResponse) external;

xf:test($inventoryCheck1,
    $inventoryCheckResponse1)
